 var faceValue="[哈哈],[呵呵],[泪],[汗],[爱你],[嘻嘻],[哼],[心],[晕],[怒],[蛋糕],[花],[抓狂],[困],[干杯],[太阳],[下雨],[伤心],[月亮],[猪头]";
 var faceSource="laugh.gif,smile.gif,cry.gif,sweat.gif,love.gif,tooth.gif,hate.gif,heart.gif,dizzy.gif,angry.gif,cake.gif,flower.gif,crazy.gif,sleepy.gif,cheer.gif,sun.gif,rain.gif,sad.gif,moon.gif,pig.gif";
<!-- 
function $(){return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);}
var OverH,OverW,ChangeDesc,ChangeH=50,ChangeW=50;
function OpenDiv(_Dw,_Dh,_Desc) {
$("Loading").innerHTML="";
OverH=_Dh;OverW=_Dw;ChangeDesc=_Desc;
$("Loading").style.display='';
if(_Dw>_Dh){ChangeH=Math.ceil((_Dh-10)/((_Dw-10)/50))}else if(_Dw<_Dh){ChangeW=Math.ceil((_Dw-10)/((_Dh-10)/50))}
 
$("Loading").style.top=(document.documentElement.clientHeight-10)/2+"px";
$("Loading").style.left=(document.documentElement.clientWidth-10)/2+"px";
OpenNow()
}
var Nw=10,Nh=10;
function OpenNow() {
if (Nw>OverW-ChangeW)ChangeW=2;
if (Nh>OverH-ChangeH)ChangeH=2;
Nw=Nw+ChangeW;Nh=Nh+ChangeH;

if(OverW>Nw||OverH>Nh) {
	if(OverW>Nw) {
	$("Loading").style.width=Nw+"px";
	$("Loading").style.left=(document.body.scrollLeft)+"px";
	}
	if(OverH>Nh) {
	$("Loading").style.height=Nh+"px";
	$("Loading").style.top=(document.body.scrollTop )+"px";
	}OpenNow();
	//window.setTimeout("OpenNow()",10)
	}else{
	Nw=10;Nh=10;ChangeH=50;ChangeW=50; 
	$("Loading").innerHTML="<table width=100%><tr><td  id=faceTd width=70%></td><td id=msgTd></td><td align=right height=16><a href='javascript:void(0);'  onclick=\"$('Loading').style.display='none'\" ><img src='img/close.png' title='关闭' class=img1></a></td></tr></table>"+ChangeDesc;
    $("status").addEventListener("input",viewNumKey,false); 
	if(localStorage.submitOnclick==$('submit').onclick)
	       $("status").value=localStorage.status;	
	}
}
function openPic(pic)
{ 
 OpenDiv(360,420,"<img src='"+pic+"' onload='fixImage(this,350,380)'  onclick=\"openNewTab('"+pic+"',false,false);\">");
}
//-->
 
function fixImage(i,w,h){ 
    var ow = i.width; 
    var oh = i.height; 
    var rw = w/ow; 
    var rh = h/oh; 
    var r = Math.min(rw,rh); 
    if (w ==0 && h == 0){ 
        r = 1; 
    }else if (w == 0){ 
        r = rh<1?rh:1; 
    }else if (h == 0){ 
        r = rw<1?rw:1; 
    } 
    if (ow!=0 && oh!=0){ 
    i.width = ow * r; 
    i.height = oh * r; 
    }else{ 
      var __method = this, args = $A(arguments); 
        window.setTimeout(function() { 
          fixImage.apply(__method, args); 
        }, 200); 
    } 
    i.onload = function(){} 
} 
 
function InsertString(tb, str){     
    tb.focus();
    if (document.all){
        var r = document.selection.createRange();
        document.selection.empty();
        r.text = str;
        r.collapse();
        r.select();
    }
    else{
        var newstart = tb.selectionStart+str.length;
        tb.value=tb.value.substr(0,tb.selectionStart)+str+tb.value.substring(tb.selectionEnd);
        tb.selectionStart = newstart;
        tb.selectionEnd = newstart;
    }
	viewNumKey();
}

function modifyCssStyle(cssStyleRuleName,cssStyleName,value)
{
 if(value.length>0)
 for(var j=0;j<document.styleSheets[0].rules.length;j++) 
       if(document.styleSheets[0].rules[j].selectorText==cssStyleRuleName)
	   { 
	    eval("document.styleSheets[0].rules["+j+"].style."+cssStyleName+"='"+value+"';");
	    break;
	   }
}

function displayOffOn(obj )
{
  if(obj.style.display=='')
  {
   obj.style.display='none';  
  }
  else
   {
   obj.style.display=''; 
   }
}

function goPage(surl)
{
 chrome.tabs.getAllInWindow(undefined, function(tabs) {
    for (var i = 0, tab; tab = tabs[i]; i++) { 
      if (tab.url==surl) {
        chrome.tabs.update(tab.id, {selected: true});
        return;
      }
    }  
	chrome.tabs.create({url:surl});
  });
}

function openNewTab(myurl, focus, remove)
{
 chrome.tabs.getAllInWindow(undefined, function(tabs) {
    for (var i = 0, tab; tab = tabs[i]; i++) { 
      if (tab.url.indexOf(myurl)==0) {
      	if (remove)
      	{
      		chrome.tabs.remove(tab.id);
      	}
      	else
      	{
	        chrome.tabs.update(tab.id, {selected: focus});
	        return;
        }
      }
    }  
	chrome.tabs.create({url:myurl, selected: focus});
  });
}

function getTime(t)
{
  var s =Math.round( (new Date()-new Date(t))/60/1000);
  if(s<60) return s+"分钟前";
  s =Math.round(s/60)
  if(s<24) return  s+"小时前";
  s =Math.round(s/24)
   return  s+"天前"; 
}
function viewNumKey()
{ 
 $('numkey').innerText=($('submit').title=='私信'?300:140)-$('status').value.length;
 if($('status').value.length>0){
 localStorage.status=$('status').value;
 localStorage.submitOnclick=$('submit').onclick;}
}
function ctrlEnter(objId)
{
if(event.ctrlKey!='undefined'&&window.event.keyCode!='undefined')
	  if(event.ctrlKey && window.event.keyCode==13)
	  $(objId).onclick();
}
function getName(name)
{
	if(localStorage.uname==name) return '我';
	else return name;
}
